from django.db import models
from django.utils import timezone

# Create your models here.

class SystemSetting(models.Model):
    key = models.CharField('设置项', max_length=50, unique=True)
    value = models.JSONField('设置值', default=dict)
    description = models.CharField('描述', max_length=200, null=True, blank=True)
    created_at = models.DateTimeField('创建时间', default=timezone.now)
    updated_at = models.DateTimeField('更新时间', auto_now=True)

    class Meta:
        verbose_name = '系统设置'
        verbose_name_plural = verbose_name
        ordering = ['key']

    def __str__(self):
        return f"{self.key}: {self.value}"
